<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>
<font size="-1">component-family:</font> javax.faces.Output <font size="-1">renderer-type:</font> javax.faces.resource.Script
</title>
<link REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">
</head>
<script>
function asd()
{
  parent.document.title=<font size="-1">component-family:</font> javax.faces.Output <font size="-1">renderer-type:</font> javax.faces.resource.Script
}
</SCRIPT>
<body BGCOLOR="white" onload="asd();">

<H2><font size="-1">HTML_BASIC render-kit</font>
<br />
<font size="-1">component-family:</font> javax.faces.Output <font size="-1">renderer-type:</font> javax.faces.resource.Script
</H2>
<HR />
<P> 

            <p class="changed_modified_2_0"><span
            class="changed_modified_2_0_rev_a
            changed_modified_2_1">Render</span> the markup for a
            <code>&lt;script&gt;</code> element that renders the script
            <code>Resource</code> specified by the optional
            <code>name</code> attribute and <code>library</code>
            attributes.</p>

<p class="changed_modified_2_0">The implementation of this renderer must
have a <a target="_"
href="../../javadocs/javax/faces/event/ListenerFor.html"><code>@ListenerFor</code></a>
annotation attached to it, at the class level, declaring <a target="_"
href="../../javadocs/javax/faces/event/PostAddToViewEvent.html"><code>PostAddToViewEvent.class</code></a>
as the value of the <code>systemEventClass</code> attribute.  The
presence of this annotation on a renderer implies the renderer
implements <a target="_"
href="../../javadocs/javax/faces/event/ComponentSystemEventListener.html"><code>ComponentSystemEventListener</code></a>,
which this renderer must do.  The implementation of
<code>processEvent()</code> must extract the <code>UIComponent</code>
from the argument event and look for the presence of the key
"<code>target</code>" in the component's attribute <code>Map</code>.  If
and only if such a key is present, the implementation of
<code>processEvent()</code> must pass the component to <a target="_"
href="../../javadocs/javax/faces/component/UIViewRoot.html#addComponentResource(javax.faces.context.FacesContext,%20javax.faces.component.UIComponent)"><code>UIViewRoot.addComponentResource()</code></a>.</p>

      <p class="changed_modified_2_0">Decode Behavior</p>

      <ul class="changed_modified_2_0">

<p>No action is required during decode for this renderer.</p>

</ul>

      <p class="changed_modified_2_0">Encode Behavior</p>

      <ul class="changed_modified_2_0">

        <p><a name="ResourceCommonGetResource">Common Algorithm for Obtaining A Resource to Render</a></p>

        <ul>

          <p>This algorithm is used by all resource renderers to obtain
          a <code>Resource</code> instance which is then rendered in a
          specific way depending on what kind of renderer is doing the
          encoding.</p>

          <ul>

	  <li><p>Look in the component attribute <code>Map</code> for a
	  value under the key <em>name</em>.</p></li>

	  <li><p>Look in the component attribute <code>Map</code> for a
	  value under the key <em>library</em>.  This attribute is
	  optional, therefore, <em>library</em> may be
	  <code>null</code>.</p></li>

	  <li><p>Create the resource by calling
	  <code>Application.getResourceHandler.createResource(<em>name</em>,
	  <em>library</em>);</code>.</p></li>

	  </p></li>

          </ul>

        </ul>

        <p><a name="ResourceCommonEncode">Common Encode Behavior</a></p>

      <ul>

       <p>This algorithm is used by all resource renderers to render the
       resource.</p>

        <p><code>encodeBegin()</code> must take no action.</p>

        <p>Because this renderer returns <code>true</code> from
        <code>getRendersChildren()</code>, the <code>encodeChildren()
        method must take the following action.</code></p>

        	<ul>

	  <li><p>If there is no <em>name</em> attribute, and the
	  argument <code>component</code> has no children, and
	  <code>ProjectStage</code> is not
	  <code>ProjectStage.Production</code>, add a
	  <code>FacesMessage</code> for this component's clientId to the
	  <code>FacesContext</code> stating that if no name attribute is
	  present, and no body content is present either, then the user
	  should take action to correct this problem.  In this case,
	  <code>encodeChildren()</code> must take no further
	  action.</p></li>

	  <li><p>If there is no <em>name</em> attribute and the argument
	  <code>component</code> <b>does</b> have children, the renderer
	  must ensure that those children are encoded as usual.</p></li>

	  <li><p>If there <b>is</b> a <em>name</em> attribute and the
	  argument <code>component</code> <b>does</b> have children, the
	  renderer must log a descriptive localized message stating that
	  the child content will be ignored.  The resource referenced by
	  the <em>name</em> attribute will be rendered in
	  <code>encodeEnd()</code>.</p></li>

	  <li><p>If there <b>is</b> a <em>name attribute</em> and the
	  argument <code>component</code> <b>does not</b> have children,
	  <code>encodeChildren()</code> must take no action.</p></li>

	</ul>

       <p><code>encodeEnd()</code> must take specific action based on
       the specific kind of resource being rendered.</p>

      </ul>

       <p>Use the algorithm <em>Common Encode Behavior</em> for
       <code>encodeBegin()</code>, <code>encodeChildren()</code> and
       <code>getRendersChildren()</code>.</p>

        <p>For <code>encodeEnd()</code>, use the algorithm <em>Common
        Algorithm for Obtaining A Resource to Render</em> above to
        obtain a reference to the <code>Resource</code> to be
        encoded.</p>

        <p>If this is NOT the first time this <code>Resource</code> has
        been referenced on this request take no action and return.</p>

        <p>Render a script element.  <span
        class="changed_modified_2_1">Call
        <code>resource.getRequestPath()</code>.  If the result contains
        a query string, take care to handle it correctly.  Pass the
        request path to a call to <code>encodeResourceURL()</code> on
        the <code>ExternalContext</code>.  Use the result as the value
        of the "src" attribute.  Use the result from calling
        <code>resource.getContentType()</code> as the value of the
        "type" attribute.</span></p>

       </ul>


</P>
<P>This renderer is responsible for rendering its children.</P><HR />
<a NAME="attributes"><!-- --></a>

<h3>Note:</h3>

<p>Attributes with a <code>pass-through</code> value of
<code>true</code> are not interpreted by the renderer and are passed
straight through to the rendered markup, without checking for validity.  Attributes with a
<code>pass-through</code> value of <code>false</code> are interpreted
by the renderer, and may or may not be checked for validity by the renderer.</p>

<table BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<tr BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<td COLSPAN="5"><font SIZE="+2">
<b>Attributes</b></font></td>
</tr>
<tr BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<th><b>attribute-name</b></th>
<th><b>pass-through</b></th>
<th><b>attribute-class</b></th>
<th><b>description</b></th>
<th><b>default-value</b></th>
</tr>
	    
<tr BGCOLOR="white" CLASS="TableRowColor">
<td ALIGN="right" VALIGN="top" WIDTH="1%"><code>
&nbsp;library
</td>
<td ALIGN="right" VALIGN="top">false</td>
<td><code>java.lang.String</code></td>
<td><div class="changed_added_2_0"><p>The <em>libraryName</em> for this resource.</p></div></td>
<td>undefined<td>
</tr>
<tr BGCOLOR="white" CLASS="TableRowColor">
<td ALIGN="right" VALIGN="top" WIDTH="1%"><code>
&nbsp;name
</td>
<td ALIGN="right" VALIGN="top">false</td>
<td><code>java.lang.String</code></td>
<td><div class="changed_added_2_0"><p>The
                <em>resourceName</em> for this resource.</p></div><div class="changed_modified_2_0_rev_a">
                <p>This attribute is required</p></div></td>
<td>undefined<td>
</tr>
<tr BGCOLOR="white" CLASS="TableRowColor">
<td ALIGN="right" VALIGN="top" WIDTH="1%"><code>
&nbsp;target
</td>
<td ALIGN="right" VALIGN="top">false</td>
<td><code>java.lang.String</code></td>
<td><div class="changed_added_2_0"><p>The
                    <em>target</em> area for which this resource will be
                    rendered.  For example, <em>target="head"</em> would
                    cause the resource to be rendered within the
                    <em>head</em> element.  <span
                    class="changed_modified_2_0_rev_a">If no value is
                    specififed, the script element is rendered at the
                    same point in the view where the tag is
                    located.</span> <span
                    class="changed_modified_2_0_rev_a">Currently
                    supported values for this attribute are "head",
                    "body", and "form".</span></p></div></td>
<td>undefined<td>
</tr>
</table>
<hr>
Copyright (c) 2003-2010 Oracle America, Inc. All Rights Reserved.
</body>
</html>
